package com.suyang.syt.util;

import com.google.gson.Gson;

public class JsonUtil {

	private static Gson gson;

	private JsonUtil() {
	}

	public static Gson getInstance() {
		if (gson == null) {
			gson = new Gson();
		}
		return gson;
	}

	public static String toJson(Object object) {
		return getInstance().toJson(object);
	}

	public static <T> T fromJson(String json, Class<T> classOfT) {
		return getInstance().fromJson(json, classOfT);
	}

}
